<?php

/**
 * Produit form base class.
 *
 * @method Produit getObject() Returns the current form's model object
 *
 * @package    lointains-espace
 * @subpackage form
 * @author     William Ong
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseProduitForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'pays_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pays'), 'add_empty' => true)),
      'nom_produit'        => new sfWidgetFormInputText(),
      'type_produit'       => new sfWidgetFormInputText(),
      'carte_geographique' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CarteGeographique'), 'add_empty' => true)),
      'image_1'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image1'), 'add_empty' => true)),
      'image_2'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image2'), 'add_empty' => true)),
      'image_3'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image3'), 'add_empty' => true)),
      'image_4'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image4'), 'add_empty' => true)),
      'image_5'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Image5'), 'add_empty' => true)),
      'court_description'  => new sfWidgetFormTextarea(),
      'moment_fort'        => new sfWidgetFormTextarea(),
      'tarifs'             => new sfWidgetFormTextarea(),
      'is_active'          => new sfWidgetFormInputCheckbox(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'pays_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Pays'), 'required' => false)),
      'nom_produit'        => new sfValidatorString(array('max_length' => 120, 'required' => false)),
      'type_produit'       => new sfValidatorString(array('max_length' => 120, 'required' => false)),
      'carte_geographique' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CarteGeographique'), 'required' => false)),
      'image_1'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Image1'), 'required' => false)),
      'image_2'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Image2'), 'required' => false)),
      'image_3'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Image3'), 'required' => false)),
      'image_4'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Image4'), 'required' => false)),
      'image_5'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Image5'), 'required' => false)),
      'court_description'  => new sfValidatorString(array('max_length' => 2000, 'required' => false)),
      'moment_fort'        => new sfValidatorString(array('required' => false)),
      'tarifs'             => new sfValidatorString(array('required' => false)),
      'is_active'          => new sfValidatorBoolean(array('required' => false)),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('produit[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Produit';
  }

}
